Better error message reporting for includes and add localizedDescription#85
Better error message reporting for includes and add localizedDescription#85mlomeli wants to merge 2 commits intomattpolzin:masterfrom
Conversation
|
Thanks for opening a PR with an implementation of a better error reporting experience! I will dig into this tonight and see how it compares in a few situations where I tend to see this type of error pop up. You will need to modify and/or add to the unit tests for the package. When you push changes, the tests run automatically, so I can see from this PR that the following test is now failing . It makes sense for that test to start failing since your code modified the desired output from similar errors, but the test needs to be rewritten to assert the new desired output is found so no one else accidentally changes it.
The easiest way to go about writing and testing the library is generally to open it in Xcode where Alternatively, you can browse to the directory containing the library from a shell and run
This is a nice thought, thank you! However, this library happens to be able to operate entirely without the Foundation library (you will notice there are no other |
|
Taking a closer look at the test failure, it states:
is not equal to
The first message in there is the new message as of this PR. The second message is the old message prior to this PR (for the failure that particular test case sets up). What I am noticing is that the message printed by the code in this PR does not contain as much information. The old message indicates two things:
|
|
I think I see what you were trying to accomplish here. I think it was confusing how the old error message stated the index of the failed include in one place and the index of the failed type in another place. Does that sound like what about the old message was confusing? In other words, the old message had two numbers and it seemed like they both referred to the same thing, so you simplified the message by just grabbing the thing being referred to. |
|
Yeah, I see that you added it in #86 which addresses the issue. |
This is the code I wrote, for #84
About the contributing Guidelines, I don't know how to test it as the playground didn't run for me, but I ran it in my project and it worked. So feel free to disregard the pull request. Just wanted to see how to share the code in a readable way.
I added the LocalizedError protocol, so you print the description when you use the localizedDescription property of the error.